project(USER_STARTER_BOOT_NATIVE_TST)

add_library(doSum_impl SHARED doSum_impl.cpp)
target_include_directories(doSum_impl PRIVATE ${ANI_INCLUDE_DIR})
target_include_directories(doSum_impl PRIVATE ${PANDA_HELPERS_SOURCE_DIR})

set(ARKTSCONFIG_PATH "${CMAKE_CURRENT_BINARY_DIR}/arktsconfig.json")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/arktsconfig.json.in" "${ARKTSCONFIG_PATH}")

compile_panda_source_list(
    TARGET_NAME user_starter_boot_native_tst_srcs
    SOURCE_LIST
        "UserRunTst.ets"
        "BootNativeAPI.ets"
    ARKTSCONFIG ${ARKTSCONFIG_PATH}
)

run_user_app(
    TARGET_NAME user_starter_boot_native_tst_run
    EXTRA_DEPS
        user_starter_boot_native_tst_srcs
        doSum_impl
        tst_lib_srcs
    CLASSNAME UserRunTst.UserRunTst
    USER_ABC_PATH ${CMAKE_CURRENT_BINARY_DIR}/UserRunTst.abc
    EXTRA_BOOT_FILES
        ${CMAKE_CURRENT_BINARY_DIR}/BootNativeAPI.abc
        ${MEASURE_NATIVE_LIB_BINARY_DIR}/MeasureNativeLib.abc
        ${TST_LIB_BINARY_DIR}/TstLib.abc
    EXTRA_LAUNCHER_OPTS
        "--PandaOpt=--ext:--native-library-path=${CMAKE_CURRENT_BINARY_DIR}:${MEASURE_NATIVE_LIB_BINARY_DIR}:${TST_LIB_BINARY_DIR}"
        "--PandaOpt=--ext:--log-level=debug"
        "--preload-class-list=${CMAKE_CURRENT_SOURCE_DIR}/preload_list.txt"
        #--PandaOpt=--ext:--verification-mode=disabled
        #--PandaOpt=--ext:--verification-mode=ahead-of-time
    ARK_AOT
)

